# coding:utf-8

__version__ = '0.0.1'
__autor__ = 'Seer'

from weibo import APIClient

APP_KEY = '1148882404'
APP_SECRET = 'a6382cc72ced53b15a2c647367722abf'
CALLBACK_URL = 'http://yuyanjia.iok.la'

client = APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL)
url = client.get_authorize_url()
print url

code = '61303333b2f5967b41812d76e4ee5af6'
rqac = client.request_access_token(code)
# token
access_token = rqac.access_token
# 过期时间
expires_in = rqac.expires_in

print access_token
print expires_in
# TODO: 在此可保存access token
client.set_access_token(access_token, expires_in)
#
print client.statuses.update.post(status=u'测试OAuth 2.0发微博')
